package cn.cheqi.recovery.api.mapper;

import cn.cheqi.recovery.api.entity.Building;
import cn.cheqi.recovery.api.entity.Community;
import cn.cheqi.recovery.api.entity.Owner;
import cn.cheqi.recovery.api.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Robin
 * @since 2020-02-23
 */
@Repository("apiCommunityMapper")
public interface CommunityMapper extends BaseMapper<Community> {

    /**
     * 通过小区ID查出该小区下的所有未入驻业主信息
     * @param communityId
     * @return
     */
    List<Owner> findAllOwnersByCommunityId(@Param("community_id") Long communityId, Page<Community> page);

    /**
     * 通过小区ID查出该小区下的所有已入驻业主信息
     * @param communityId
     * @return
     */
    List<User> findAllUsersByCommunityId(@Param("community_id") Long communityId, Page<Community> page);

    /**
     * 通过小区ID查出该小区下的所有楼栋信息
     * @param communityId
     * @param page
     * @return
     */
    List<Building> findAllBuildingsByCommunityId(@Param("community_id") Long communityId, Page<Community> page);
}
